<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>网站后台管理系统</title>
<meta name="keywords" content="">
<meta name="description" content="">
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="css/ie6.css"/>
<![endif]-->
<link rel="stylesheet" type="text/css"  href="../../../../public/layui/css/layui.css">
<link href="../../../../public/admin/css/style_v2.0.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/layui/css/layui.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/style_v2.0.css" />
<script type="text/javascript" src="__PUBLIC__/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
</head>
<body>
<div class="position mt10">当前位置：<a href="{:U('Index/main')}">后台首页</a> > <a href="{:U('System/index')}">系统设置</a>  </div>
<div id="container">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>系统设置</legend>
</fieldset>
<div class="c"></div>
<div class="layui-form" style="background-color:#FFFFFF;">
<form name=reg action="{:U('Admin/System/sys_update',array('sid' => $data['sid']))}"  enctype="multipart/form-data"  method="post"  class="layui-form">
    <div class="layui-tab layui-tab-card" lay-filter="tab">
      <ul class="layui-tab-title">
        <li class="layui-this">基本设置</li>
        <li>安全设置</li>
        <li>邮箱设置</li>
        <li>参数设置</li>
        <li>其他设置</li>
      </ul>
      <div class="layui-tab-content">
      <div class="layui-tab-item layui-show">
        <table class="layui-table">
        <tr>
          <td width="20%" align="right">站点名称：</td>
          <td width="80%">
          <span class="table_span" style="width:300px; float:left;"><input name="webname" type="text" id="webname" value="{$data.webname}" required  lay-verify="" placeholder="站点名称" autocomplete="off" class="layui-input"></span>
          <span class="table_txt"></span>
          </td>
        </tr>
        <tr>
          <td width="20%" align="right">站点网址：</td>
          <td width="80%">
          <span class="table_span" style="width:300px; float:left;"><input name="weburl" type="text" id="weburl" value="{$data.weburl}" required  lay-verify="" placeholder="站点网址" autocomplete="off" class="layui-input"></span>
          <span class="table_txt"></span>
          </td>
        </tr>
        <tr>
          <td width="20%" align="right">网站logo：</td>
          <td width="80%">
          <span class="table_span" style="width:300px; float:left;">
            <notempty name="data.weblogo"><span style="float:left;"><img src="__ROOT__{$data.weblogo}" height="70" style="max-width:180px; padding-right:10px;"></span></notempty>
      <input name="photo1" type="text" id="photo1" value="{$data.weblogo}" autocomplete="off" class="layui-input" style="width:500px;">
      <input type='file'  name='photo' multiple>
          </span>        
          </td>
        </tr>
        <tr>
          <td width="20%" align="right"><font color=red size="1">·</font>网站关键词：</td>
          <td width="80%">
          <span class="table_span" style="width:300px; float:left;">
          <textarea name="keyword" type="text" id="keyword"  lay-verify="" placeholder="网站关键词" autocomplete="off" class="layui-textarea" style="height:40px;">{$data.keyword}</textarea>
          </span>
          <span class="table_txt"></span>
          </td>
        </tr>
        <tr>
          <td width="20%" align="right">ICP备案：</td>
          <td width="80%">
          <span class="table_span" style="width:200px; float:left;">
          <input name="icp" type="text" id="icp" value="{$data.icp}"  lay-verify="" placeholder="ICP备案" autocomplete="off" class="layui-input"></span>
          <span class="table_txt"></span>
          </td>
        </tr>
         <tr>
          <td width="20%" align="right">版权信息：</td>
          <td width="80%">
          <span class="table_span" style="width:300px; float:left;"><textarea name="copyright" type="text" id="copyright"   lay-verify="" placeholder="备注" autocomplete="off" class="layui-textarea" style="height:60px;">{$data.copyright}</textarea></span>
          </td>
        </tr>
        <tr>
          <td align="right"><font color=red size="1">·</font>修改时间：</td>
          <td><span class="table_span" style="width:200px; float:left;"><input name="update_time" type="text" id="update_ttime" value="{$data.update_time|date='Y-m-d H:i:s',###}"  autocomplete="off" class="layui-input ico-date" ></span></td>
          </tr>
        </table>
      </div>
      <div class="layui-tab-item">
        <table class="layui-table">
        <tr>
          <td width="20%" align="right">开启网站：</td>
          <td width="80%">
          <div class="layui-input-block" style="width:60px; float:left; margin-left:10px;">
              <input type="checkbox" name="switch" lay-skin="switch"  lay-text="开启|关闭" checked>
          </div>
          </td>
        </tr>
        <tr>
          <td width="20%" align="right">限制ip：</td>
          <td width="80%">
          <span class="table_span" style="width:300px; float:left;">
          <input name="icp" type="text" id="icp" value="{$data.limitip}"  lay-verify="" placeholder="限制ip" autocomplete="off" class="layui-input">
          </span>
          </td>
        </tr>
        <tr>
          <td width="20%" align="right">最大登录次数：</td>
          <td width="80%">
          <span class="table_span" style="width:60px; float:left;">
          <input name="maxlogin" type="text" id="maxlogin" value="{$data.maxlogin}"  autocomplete="off" class="layui-input" >
          </span>
          </td>
        </tr>
        </table>
     </div>
     <div class="layui-tab-item">
     <table class="layui-table">
        <tr>
          <td width="20%" align="right">邮件发送模式：</td>
          <td width="80%">
          <div class="layui-input-block" style="width:300px; float:left; margin-left:10px;">
             <input type="radio" name="sms_model" value="smtp" title="SMTP 函数发送" checked>
             <input type="radio" name="sms_model" value="mail" title="mail 模块发送" >
          </div>
          </td>
        </tr>
        <tr>
          <td width="20%" align="right">邮件服务器：</td>
          <td width="80%">
          <span class="table_span" style="width:300px; float:left;">
          <input name="mail_host" type="text" id="mail_host" value="{$data.mail_host}"  lay-verify="" placeholder="SMTP" autocomplete="off" class="layui-input">
          </span>
          </td>
        </tr>
        <tr>
          <td width="20%" align="right">邮件发送端口：</td>
          <td width="80%">
          <span class="table_span" style="width:300px; float:left;">
          <input name="mail_port" type="text" id="mail_port" value="{$data.mail_port}"  autocomplete="off" class="layui-input" >
          </span>
          </td>
        </tr>
        <tr>
          <td width="20%" align="right">发件人地址：</td>
          <td width="80%">
          <span class="table_span" style="width:300px; float:left;">
          <input name="mail_from" type="text" id="mail_from" value="{$data.mail_from}"  autocomplete="off" class="layui-input" >
          </span>
          </td>
        </tr>
        <tr>
          <td width="20%" align="right">发件人姓名：</td>
          <td width="80%">
          <span class="table_span" style="width:300px; float:left;">
          <input name="mail_fromname" type="text" id="mail_fromname" value="{$data.mail_fromname}"  autocomplete="off" class="layui-input" >
          </span>
          </td>
        </tr>
        <tr>
          <td width="20%" align="right">AUTH LOGIN验证	：</td>
          <td width="80%">
          <span class="table_span" style="width:300px; float:left;">
          <input name="mail_smtpauth" type="radio" id="mail_smtpauth" value="1"  autocomplete="off" class="layui-input"  title="开启" checked>
          <input name="mail_smtpauth" type="radio" id="mail_smtpauth" value="0"  autocomplete="off" class="layui-input"  title="关闭">
          </span>
          </td>
        </tr>
        <tr>
          <td width="20%" align="right">验证用户名：</td>
          <td width="80%">
          <span class="table_span" style="width:300px; float:left;">
          <input name="mail_username" type="text" id="mail_username" value="{$data.mail_username}"  autocomplete="off" class="layui-input" >
          </span>
          </td>
        </tr>
         <tr>
          <td width="20%" align="right">验证密码：</td>
          <td width="80%">
          <span class="table_span" style="width:300px; float:left;">
          <input name="mail_password" type="text" id="mail_password" value="{$data.mail_password}"  autocomplete="off" class="layui-input" >
          </span>
          </td>
        </tr>
        <tr>
          <td width="20%" align="right">邮件设置测试：</td>
          <td width="80%">
          <div class="fee_box">
              <span class="table_txt">接收邮箱：</span>
              <span style="width:500px; float:left;"><input name="mail_test" type="text" id="mail_test" value="{$data.email_test}"  autocomplete="off" class="layui-input"></span>
          </div>
          <div class="fee_box">
              <span class="table_txt">邮箱主题：</span>
              <span style="width:500px; float:left;"><input name="mail_title" type="text" id="mail_title" value="{$data.email_title}"  autocomplete="off" class="layui-input"></span>
          </div>
          <div class="fee_box">
              <span class="table_txt">邮箱内容：</span>
              <span style="width:520px; float:left;background-color:#FFFFFF;"><textarea name="mail_content" type="text" id="mail_content"   autocomplete="off" class="layui-textarea" style=" height:200px;">{$data.email_content|stripcslashes}</textarea></span>
          </div>
          <div class="c"></div>
          <div class="fee_box">
          <span style="padding-left:80px"><input type="button"  onClick="javascript:test_mail();" value="测试邮箱" class="layui-btn"></span>
          </div>
          </td>
        </tr>
        </table>
     </div>
     <div class="layui-tab-item">
     <table class="layui-table">
        <tr>
          <td width="20%" align="right">分页数量：</td>
          <td width="80%">
          <div class="layui-input-block" style="width:100px; float:left; margin-left:10px;">
             <input name="sys_pagenum" type="text" id="sys_pagenum" value="{$data.sys_pagenum}"  autocomplete="off" class="layui-input" >
          </div>
          </td>
        </tr>
        <tr>
          <td width="20%" align="right">上传图片限制：</td>
          <td width="80%">
          <span class="table_span" style="width:60px; float:left;">
          <input name="sys_picsize" type="text" id="sys_picsize" value="{$data.sys_picsize}"  autocomplete="off" class="layui-input" >
          </span>
          <span class="table_txt">（M）</span>
          </td>
        </tr>
        <tr>
          <td width="20%" align="right">上传附件限制：</td>
          <td width="80%">
          <span class="table_span" style="width:60px; float:left;">
          <input name="sys_attasize" type="text" id="sys_attasize" value="{$data.sys_attasize}"  autocomplete="off" class="layui-input" >
          </span>
          <span class="table_txt">（M）</span>
          </td>
        </tr>
        <tr>
          <td width="20%" align="right">开启广告推送：</td>
          <td width="80%">
          <div class="layui-input-block" style="width:60px; float:left; margin-left:10px;">
              <input type="checkbox" name="isad" lay-skin="switch"  lay-text="开启|关闭" >
          </div>
          </td>
        </tr>
        </table>
     </div>
      </div>
      <table class="layui-table">
      <tr> 
          <td colspan=2 align="center" valign="middle">
            <input type="submit" name="Submit" value="确&nbsp; &nbsp;定" class="layui-btn" >
            <input type="reset" name="Submit2" value="重　置" class="layui-btn layui-btn-primary" >		 </td>
        </tr>
        </table>
   </div>
</form>  
</div>
</div>
</body>
</html>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<script>
//Demo
layui.use(['form','layedit','element'], function(){
  var form = layui.form;
  var element = layui.element;
  var layedit = layui.layedit;
  
  layedit.set({
		uploadImage: {
			url: '{:U("System/upload_img")}',//url
			type: 'post',
			dataType:'json',
			success: function(data){
			   console.log(data);
			}
		}
   });
  //构建一个默认的编辑器
  var index = layedit.build('mail_content', {
       height: 180 //设置编辑器高度
	   }
  );
  

   
  element.on('tab(tab)', function(data){
  //  console.log(data);
  });
  
  //监听提交
  form.on('submit(btnDel)', function(data){
    //layer.msg(JSON.stringify(data.field));
	title: '最终的提交信息'
	return true;
  });

});

function test_mail(){
    var mail_test = $("#mail_test").val();
	var mail_title = $("#mail_title").val();
	var mail_content = $("#mail_content").val();
	//console.log(mail_content);
	if(mail_test.length == 0){
	    $("#mail_test").focus();
		alert("邮箱不能为空");
		return false;
	}
	if(mail_title.length == 0){
	    $("#mail_title").focus();
		alert("邮箱主题不能为空");
		return false;
	}
	if(mail_test.length){
	    $.ajax({
		    url:'{:U("System/send_email")}',
			dataType:'json',
			Type:'get',
			data:{'mail_test': mail_test,'mail_title': mail_title,'mail_content': $("#mail_content").val()},
			success:function(data){
			    console.log($("#mail_content").val());
			    if(data){
				    alert("邮箱发送成功");
				}else{
				    alert("邮箱发送失败");
				}
			}		
		});
		
	}
}

</script>
